from ability.models import *
questions = Question.objects.filter(id__gt=1045)
i = 0
for q in questions:
    if i % 5 == 0:
        i = i + 1
        q.question_type = 'MC'
        q.save()
        cd = ChoiceDetail()
        cd.describe = "测试单选题11111"
        cd.question = q
        cd.save()
        for j in range(4):
            od = OptionDetail()
            od.owner = UserProfile.objects.get(id=2)
            od.content = "测试单选题选项11111"
            od.choice_detail = cd
            if j == 0:
                od.is_correct = True
            od.save()
    elif i % 5 == 1:
        i = i + 1
        q.question_type = 'MA'
        q.save()
        cd = ChoiceDetail()
        cd.describe = "测试多选题11111"
        cd.question = q
        cd.save()
        for j in range(4):
            od = OptionDetail()
            od.owner = UserProfile.objects.get(id=2)
            od.content = "测试多选题选项11111"
            od.choice_detail = cd
            if j == 0:
                od.is_correct = True
            elif j == 1:
                od.is_correct = True
            od.save()
    elif i % 5 == 2:
        i = i + 1
        q.question_type = 'TF'
        q.save()
        cd = ChoiceDetail()
        cd.describe = "测试判断题11111"
        cd.question = q
        cd.save()
        for j in range(2):
            od = OptionDetail()
            od.owner = UserProfile.objects.get(id=2)
            od.content = "测试判断题选项11111"
            od.choice_detail = cd
            if j == 0:
                od.is_correct = True
            od.save()
    elif i % 5 == 3:
        i = i + 1
        q.question_type = 'BL'
        q.save()
        cd = BlankDetail()
        cd.describe = "测试填空题11111"
        cd.answer = "测试答案1;测试答案2；测试答案3"
        cd.question = q
        cd.save()
    elif i % 5 == 4:
        i = i + 1
        cd = BlankDetail()
        cd.describe = "测试简答题11111"
        cd.answer = "测试答案1;测试答案2；测试答案3"
        cd.question = q
        cd.save()

        